﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;


namespace AMing.Data
{
    public class Config
    {
        static Config()
        {
            LoadConfig("db_ip", ref db_ip);
            LoadConfig("db_name", ref db_name);
            LoadConfig("db_username", ref db_username);
            LoadConfig("db_pwd", ref db_pwd);
        }

        private static string db_ip = "184.168.194.58";
        /// <summary>
        /// 数据库地址IP
        /// </summary>
        public static string DB_IP
        {
            get { return db_ip; }
        }


        private static string db_name = "y2443_api_db";
        /// <summary>
        /// 数据名
        /// </summary>
        public static string DB_Name
        {
            get { return db_name; }
        }


        private static string db_username = "api_db";
        /// <summary>
        /// 数据库用户名
        /// </summary>
        public static string DB_UserName
        {
            get { return db_username; }
        }

        private static string db_pwd = "db2443";
        /// <summary>
        /// 数据库用户密码
        /// </summary>
        public static string DB_Password
        {
            get { return db_pwd; }
        }



        static void LoadConfig(string key, ref string val)
        {
            string data = WebConfigurationManager.AppSettings[key];
            if (!string.IsNullOrWhiteSpace(data))
            {
                val = data;
            }
        }
    }
}
